<template>
  <div>
    <Header_h />
    <nav class="details_nav">
      <div class="containers">
              <span class="title_color" @click="$router.push('/web/home')">首页 / </span>
        <span class="title_color" @click="$router.push('/web/protection')">海外维权</span>
      </div>
    </nav>
    <article class="core_content">
      <div class="containers">
        <div class="enginer_box s_flex s_justify_content">
          <div class="enginer_left s_flex s_align_items s_flex-column">
            <div class="enginer_left_box">
              <div
                v-for="item in nav"
                :key="item.id"
                @click="showDetails(item.id)"
                :class="curtIndex == item.id ? 'ck' : ''"
              >
                <span v-if="list.type == 1">{{ item.name1 }}</span>
                <span v-if="list.type == 2 && item.name2 ">{{ item.name2 }}</span>
                <span v-if="list.type == 3 && item.name3">{{ item.name3 }}</span>
              </div>
            </div>
          </div>
          <div class="enginer_right">
            <div v-for="item in nav" :key="item.id">
              <div :class="`listshow${item.id}`" v-if="list.type == 2 && item.name2 || list.type == 3 && item.name3 || list.type == 1 && item.name1" >
                <div class="introduction">
                  <h4 class="s_flex s_align_items title_color">
                    <span class="clonu"></span> 
                     <span v-if="list.type == 1">{{ item.name1 }}</span>
                    <span v-if="list.type == 2 ">{{ item.name2 }}</span>
                    <span v-if="list.type == 3 ">{{ item.name3 }}</span>
                  </h4>
                </div>
                <div class="p_top desc_p">
                  <p v-if="list.type == 1 && item.name1 == '概述'" v-html="list.patent_desc"></p>
                  <p v-if="list.type == 1 && item.name1 == '专利申请'" v-html="list.patent_apply"></p>
                  <p v-if="list.type == 1 && item.name1 == '专利诉讼'" v-html="list.patent_litigation"></p>
                  <p v-if="list.type == 1 && item.name1 == '专利异议'" v-html="list.patent_objection"></p>

                  <p v-if="list.type == 2 && item.name2 == '商标申请'" v-html="list.trademark_apply"></p>
                  <p v-if="list.type == 2 && item.name2 == '商标诉讼'" v-html="list.trademark_litigation"></p>
                  <p v-if="list.type == 2 && item.name2 == '商标异议'" v-html="list.trademark_objection"></p>

                  <p v-if="list.type == 3 && item.name3 == '警告函正文'" v-html="list.content"></p>

                </div>
                <!-- <div class="p_top">
                </div>
                <div class="p_top">
                </div>
                <div class="p_top">
                </div> -->
              </div>
            </div>
          </div>
        </div>
      </div>
    </article>
    <Footer />
    <navItem />
      <rightMenu @moveTo="moveTo" />
  </div>
</template>

<script>
import Header_h from "@/components/Header_h";
import Footer from "@/components/Footer";
import rightMenu from "@/components/web/rightMenu";
import { lawInfo } from "@/api/web";

export default {
  components: {
    Header_h,
    Footer,
    
    rightMenu
  },
  data() {
    return {
      list: [],
      curtIndex: 1,
      nav: [
        {
          id: 1,
          name1: "概述",
          name2: "商标申请",
          name3: "警告函正文",
        },
        {
          id: 2,
          name1: "专利申请",
          name2: "商标诉讼",
        },
        {
          id: 3,
          name1: "专利诉讼",
          name2: "商标异议",
        },
        {
          id: 4,
          name1: "专利异议",
        },
      ],
      showIndex: 1,
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
     moveTo() {
      window.scrollTo(0, 0);
    },
    async getList() {
      try {
        this.list = await lawInfo({ law_id: this.$route.query.id });
      } catch (error) {
        this.$message.success(error.message);
      }
    },
    showDetails(num) {
      this.curtIndex = num;
      var el = document.getElementsByClassName(`listshow${num}`)[0];
      // console.log(el.offsetTop);
      if (this.showIndex == num) {
        this.showIndex = null;
      } else {
        this.showIndex = num;
      }
      this.$nextTick(function () {
        window.scrollTo({ behavior: "smooth", top: el.offsetTop });
      });
    },
  },
};
</script>

<style lang="less" scoped>
.details_nav {
  width: 100%;
  padding: 15px 0;
  background: #edf1f4;
}
.enginer_box {
  position: relative;
  .enginer_left {
    width: 20%;
    position: relative;

    .enginer_left_box {
      width: 10%;
      height: 186px;
      background: #ffffff;
      box-shadow: 0px 0px 18px 0px rgba(103, 105, 113, 0.07);
      border-radius: 10px;
      justify-content: center;
      position: fixed;
      top: 20%;
      z-index: 1;
      text-align: center;
      cursor: pointer;
      div {
        margin-top: 25px;
      }
    }
  }
  .enginer_right {
    width: 70%;
  }
}
.core_content {
  background: #f7fbfe;
  padding: 80px 0;
}
.enginer_right {
  .head {
    .user_imgs {
      width: 218px;
      height: 218px;
      margin-right: 47px;
      img {
        width: 100%;
        object-fit: contain;
      }
    }
  }
  .info {
    margin-top: 47px;
    p {
      margin-bottom: 18px;
    }
  }
}
.clonu {
  width: 5px;
  height: 19px;
  background: #0f6ac7;
  box-shadow: 1px 2px 4px 0px rgba(79, 135, 251, 0.35);
  display: inline-block;
  margin-right: 5px;
}
.introduction {
  padding: 20px 0;
  border-bottom: 1px solid #eee;
}
.p_top {
  padding: 40px 0;
}
.hovers {
  padding: 20px 0 0 20px;
  cursor: pointer;
}
.hovers:hover {
  background-color: #f4f5f7;
}
.patent_info {
  display: flex;
  margin: 10px 0;
  .info_img {
    width: 188px;
    height: 237px;
    background: rgba(255, 255, 255, 1);
    border: 1px solid rgba(230, 233, 240, 1);
    border-radius: 5px;
    text-align: center;
  }
}
.info_text {
  margin-left: 30px;
  .info_text_div {
    margin-bottom: 19px;
  }
}
.patent_tag_sq {
  height: 24px;
  line-height: 24px;
  background: #45a321;
  border-radius: 4px;
  border: none;
}
.patent_tag_info {
  height: 24px;
  line-height: 24px;
  background: #6a7687;
  border-radius: 4px;
  border: none;
}
.patent_tag_orange {
  height: 24px;
  line-height: 24px;
  background: #ffa033;
  border-radius: 4px;
  border: none;
}
.Subhead {
  color: #2a8b2d;
  margin-right: 27px;
}
/deep/ .desc_p img{
  width:100%;
}
</style>